package com.uujava.minibox.gui;

import java.awt.FlowLayout;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

import javax.swing.JFrame;
import javax.swing.JPanel;

import com.mxcyk.minibox.skins.ImageButton;
import com.uujava.minibox.ui.panel.ImagePane;
/**
 * 头部标题控制和三个控制按钮
 * @see org.k.GUI.Title;
 * @author k 2013年5月19日 12:04:35
 * @version 1.0
 */
public class Title extends ImagePane{
	JPanel controlPanel;
	ImageButton butMin,butMax,butExit;
	public ImageButton getButMin() {
		return butMin;
	}
	public void setButMin(ImageButton butMin) {
		this.butMin = butMin;
	}
	public ImageButton getButMax() {
		return butMax;
	}
	public void setButMax(ImageButton butMax) {
		this.butMax = butMax;
	}
	public ImageButton getButExit() {
		return butExit;
	}
	public void setButExit(ImageButton butExit) {
		this.butExit = butExit;
	}
	public Title() {
		
		controlPanel=contro();
		add(controlPanel);
		setLayout(new FlowLayout(FlowLayout.RIGHT,1,0));//右对齐 | 对齐方式以及指定的水平和垂直间隙。
	}
	/**
	 * @return 控制按钮面板
	 */
	private JPanel contro(){
		JPanel jp=new JPanel();
		jp.setOpaque(false);//背景透明
		jp.setAlignmentX(FlowLayout.RIGHT);//右对齐
		
		butMin=new ImageButton("/Skins/MinButton_Hover.png", "/Skins/MinButton_Down.png", "/Skins/MinButton_Normal.png");
		butMax=new ImageButton("/Skins/ColorButton_Hover.png", "/Skins/ColorButton_Normal.png", "/Skins/ColorButton_Down.png");
		butExit=new ImageButton("/Skins/CloseButton_Normal.png", "/Skins/CloseButton_Hover.png", "/Skins/CloseButton_Down.png");

		jp.add(butMin);jp.add(butMax);jp.add(butExit);
		//jp.add(new JButton("hel"));
		return jp;
	}
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		JFrame jf=new JFrame();
		Title tit=new Title();
		
		
		tit.butMin.addMouseListener(new MouseListener() {
			
			@Override
			public void mouseReleased(MouseEvent e) {
				// TODO Auto-generated method stub
				
			}
			
			@Override
			public void mousePressed(MouseEvent e) {
				// TODO Auto-generated method stub
				
			}
			
			@Override
			public void mouseExited(MouseEvent e) {
				// TODO Auto-generated method stub
				
			}
			
			@Override
			public void mouseEntered(MouseEvent e) {
				// TODO Auto-generated method stub
				
			}
			
			@Override
			public void mouseClicked(MouseEvent e) {
				// TODO Auto-generated method stub
				System.out.println("点击了");
			}
		});
		
		
		
		
		
		tit.setBackImage("/Skins/BackgroundTitleLeft_Old.png");
		jf.add(tit);
		jf.setSize(255, 30);
		jf.setVisible(true);

	}

}
